<template>
    <div class="newsinfo-container">
       <h3 class="title">{{news.title}}</h3>
       <p class="subtitle">
           <span>发布时间：{{news.time}}</span>
           <span>点击：{{news.click}}</span>
       </p>
       <div class="content" v-html="news.content">

       </div>
       <comment :id="this.id"></comment>
    </div>
</template>

<script>
import Comment from '../../components/news/Comment'
import Toast from 'mint-ui'
export default {
    data(){
        return{
        id:this.$route.params.id,
        news:[]
        }
    },
    created(){
        this.togetnews()
    },
    methods:{
        togetnews(){
            this.$http.get("http://127.0.0.1:5000/api/getnew/"+this.id).then(result=>{
                if(result.body.status == 0){
                 this.news = result.body.message
                 console.log( result.body.message)
                }else{
                 Toast('数据读取错误')
                }
            })
        }
    },
    components:{
        'comment':Comment
    }
}
</script>

<style lang="less">
 .newsinfo-container{
     padding: 0 4px;
     .title{
         font-size:16px;
         text-align: center;
         margin:15px 0;
         color:red;
     }
     .subtitle{
         font-size:13px;
         color:#226aff;
         display: flex;
         justify-content: space-between;
     }
     .content{
         img{
             width:100%;
         }
     }
 }
    
</style>